<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>生命周期事件</title>
  </head>
  <body>
    <script type="module">
      import { createApp } from "https://unpkg.com/petite-vue?module";
      createApp({
        show: true,
        change() {
          this.show = !this.show;
        },
      }).mount("#app");
    </script>

    <div id="app">
      <button @click="change">切换</button>
      <div
        v-if="show"
        @vue:mounted="console.log('mounted on: ', $el)"
        @vue:unmounted="console.log('unmounted: ', $el)"
      >
        这个地方是否显示
      </div>
    </div>
  </body>
</html>
